package com.itmumu.miniwechat.common.config;

import com.itmumu.miniwechat.common.interceptor.JwtInteceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Resource
    private JwtInteceptor jwtInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor) // 添加拦截器
                .addPathPatterns("/**")
                .excludePathPatterns("/account/checkCode")
                .excludePathPatterns("/account/register")
                .excludePathPatterns("/account/login");
    }

}
